<template>
	<view class="inform">
		<headertop title="意见反馈" str1="oridei" :back1="back1"></headertop>
		<image src="https://jingwei.xunfuzhifuzaixian.com/static/images/Rectangle 23094@2x.png" class="inform_back"
			mode=""></image>
		<view class="fomrs">
			<view class="fomrs_line">
				<view class="t1">
					请选择反馈类型
				</view>
				<view class="inputbopx" @click="show=true">
					<input type="text" v-model="form.feedtype" :disabled="true" placeholder="请选择" />
					<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Frame@2x.png" mode=""></image>
				</view>
			</view>
			<view class="fomrs_line">
				<view class="t1">
					反馈标题
				</view>
				<view class="inputbopx">
					<input v-model="form.title" type="text" placeholder="请输入反馈标题" />
				</view>
			</view>
			<view class="fomrs_line">
				<view class="t1">
					问题描述
				</view>
				<view class="inputbopx1">
					<textarea name="" v-model="form.content" id="" placeholder="请输入问题描述" cols="30" rows="10"></textarea>
				</view>
			</view>
		</view>
		<view class="" style="height: 200rpx;">

		</view>
		<view class="fixedbox">
			<view class="btn" @click="save">
				提交
			</view>
		</view>
		<u-picker @confirm="confirm" @cancel="show=false" :show="show" keyName="title" :columns="columns"></u-picker>
	</view>
</template>

<script setup>
	// import {
	// 	feedtype,
	// 	addfeed
	// } from '@/common/api/api.js'
	import headertop from '@/components/header.vue'
	import {
		onPageScroll,
		onLoad,
		onShow,
		onReachBottom
	} from "@dcloudio/uni-app";
	import {
		$api
	} from '../../ulm';
	import {
		ref,
		onMounted,
		reactive,
	} from 'vue'
	const back1 = ref('')
	const barHeight = ref('')
	const statusBarHeight = ref('')
	const total = ref(0)
	const list = ref([])
	const show = ref(false)
	const form = reactive({
		feedtype: '',
		title: '',
		content: ''
	})
	const columns = ref([])
	const query = reactive({
		page: 1,
		limit: 10
	})
	onLoad(() => {
		inittype()
	})
	onPageScroll((e) => {
		if (e.scrollTop > 100) {
			back1.value = '#CAEEFF'
		} else {
			back1.value = ''
		}
	})
	async function inittype() {
		const res = await $api.feedtype()
		if (res.code == 1) {
			columns.value = [res.data]
		}
	}

	function confirm(e) {
		form.feedtype = e.value[0]['title']
		show.value = false
	}
	async function save() {
		for (var i in form) {
			if (!form[i]) {
				uni.showToast({
					title: '内容不能为空',
					icon: 'none'
				})
				return
			}
		}
		const res = await $api.addfeed(form)
		if (res.code == 1) {
			setTimeout(() => {
				uni.showToast({
					title: '提交成功'
				})
			}, 500)
			uni.navigateBack()
		}
	}
</script>

<style lang="scss">
	page {
		background: #F7F8FA;
	}

	.inform {
		width: 100%;
		overflow: hidden;
		position: relative;

		.fixedbox {
			width: 100%;
			overflow: hidden;
			height: 184rpx;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: fixed;
			bottom: 0%;

			.btn {
				width: 686rpx;
				height: 88rpx;
				background: #13A2E6;
				border-radius: 16rpx;
				text-align: center;
				line-height: 88rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 88rpx;
				margin: auto;
				margin-top: 22rpx;
			}
		}

		&_back {
			width: 100%;
			height: 278rpx;
			position: absolute;
			z-index: -1;
		}

		.fomrs {
			width: 686rpx;
			margin: auto;
			overflow: hidden;
			margin-top: 204rpx;

			&_line {
				width: 100%;
				overflow: hidden;
			}

			.t1 {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #1D2129;
				margin-top: 32rpx;
			}

			.inputbopx1 {
				width: 686rpx;
				border-radius: 12rpx 12rpx 12rpx 12rpx;
				margin-top: 20rpx;
				overflow: hidden;
				background: #FFFFFF;
				height: 260rpx;

				textarea {
					width: 630rpx;
					margin-top: 24rpx;
					margin-left: 28rpx;
					height: 200rpx;
				}
			}

			.inputbopx {
				width: 686rpx;
				height: 88rpx;
				background: #FFFFFF;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				input {
					width: 650rpx;
					margin-left: 28rpx;
				}

				image {
					width: 32rpx;
					height: 32rpx;
					margin-right: 28rpx;
				}
			}
		}






	}
</style>